.class public Lcom/vividsolutions/jts/algorithm/CGAlgorithms;
.super Ljava/lang/Object;
.source "CGAlgorithms.java"


# direct methods
.method public constructor <init>()V
    .locals 0

    .line 87
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static computeOrientation(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)I
    .locals 0

    .line 250
    invoke-static {p0, p1, p2}, Lcom/vividsolutions/jts/algorithm/CGAlgorithms;->orientationIndex(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)I

    move-result p0

    return p0
.end method

.method public static distancePointLine(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)D
    .locals 23

    move-object/from16 v0, p0

    move-object/from16 v1, p1

    move-object/from16 v2, p2

    .line 267
    invoke-virtual/range {p1 .. p2}, Lcom/vividsolutions/jts/geom/Coordinate;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_0

    invoke-virtual/range {p0 .. p1}, Lcom/vividsolutions/jts/geom/Coordinate;->distance(Lcom/vividsolutions/jts/geom/Coordinate;)D

    move-result-wide v0

    return-wide v0

    .line 281
    :cond_0
    iget-wide v3, v0, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    iget-wide v5, v1, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    sub-double v7, v3, v5

    iget-wide v9, v2, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    sub-double v11, v9, v5

    mul-double v7, v7, v11

    iget-wide v11, v0, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    iget-wide v13, v1, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    sub-double v15, v11, v13

    move-wide/from16 v17, v3

    iget-wide v3, v2, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    sub-double v19, v3, v13

    mul-double v15, v15, v19

    add-double/2addr v7, v15

    sub-double v15, v9, v5

    sub-double v19, v9, v5

    mul-double v15, v15, v19

    sub-double v19, v3, v13

    sub-double v21, v3, v13

    mul-double v19, v19, v21

    add-double v15, v15, v19

    div-double/2addr v7, v15

    const-wide/16 v15, 0x0

    cmpg-double v19, v7, v15

    if-gtz v19, :cond_1

    .line 285
    invoke-virtual/range {p0 .. p1}, Lcom/vividsolutions/jts/geom/Coordinate;->distance(Lcom/vividsolutions/jts/geom/Coordinate;)D

    move-result-wide v0

    return-wide v0

    :cond_1
    const-wide/high16 v15, 0x3ff0000000000000L    # 1.0

    cmpl-double v19, v7, v15

    if-ltz v19, :cond_2

    .line 286
    invoke-virtual {v0, v2}, Lcom/vividsolutions/jts/geom/Coordinate;->distance(Lcom/vividsolutions/jts/geom/Coordinate;)D

    move-result-wide v0

    return-wide v0

    :cond_2
    sub-double v7, v13, v11

    sub-double v11, v9, v5

    mul-double v7, v7, v11

    sub-double v11, v5, v17

    sub-double v15, v3, v13

    mul-double v11, v11, v15

    sub-double/2addr v7, v11

    sub-double v11, v9, v5

    sub-double/2addr v9, v5

    mul-double v11, v11, v9

    sub-double v5, v3, v13

    sub-double/2addr v3, v13

    mul-double v5, v5, v3

    add-double/2addr v11, v5

    div-double/2addr v7, v11

    .line 301
    invoke-static {v7, v8}, Ljava/lang/Math;->abs(D)D

    move-result-wide v3

    iget-wide v5, v2, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    iget-wide v7, v1, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    sub-double v9, v5, v7

    sub-double/2addr v5, v7

    mul-double v9, v9, v5

    iget-wide v5, v2, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    iget-wide v0, v1, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    sub-double v7, v5, v0

    sub-double/2addr v5, v0

    mul-double v7, v7, v5

    add-double/2addr v9, v7

    invoke-static {v9, v10}, Ljava/lang/Math;->sqrt(D)D

    move-result-wide v0

    mul-double v3, v3, v0

    return-wide v3
.end method

.method public static isCCW([Lcom/vividsolutions/jts/geom/Coordinate;)Z
    .locals 12

    .line 179
    array-length v0, p0

    const/4 v1, 0x1

    sub-int/2addr v0, v1

    const/4 v2, 0x0

    .line 182
    aget-object v3, p0, v2

    move-object v5, v3

    const/4 v3, 0x1

    const/4 v4, 0x0

    :goto_0
    if-gt v3, v0, :cond_1

    .line 185
    aget-object v6, p0, v3

    .line 186
    iget-wide v7, v6, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    iget-wide v9, v5, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    cmpl-double v11, v7, v9

    if-lez v11, :cond_0

    move v4, v3

    move-object v5, v6

    :cond_0
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    :cond_1
    move v3, v4

    :cond_2
    sub-int/2addr v3, v1

    if-gez v3, :cond_3

    move v3, v0

    .line 197
    :cond_3
    aget-object v6, p0, v3

    invoke-virtual {v6, v5}, Lcom/vividsolutions/jts/geom/Coordinate;->equals2D(Lcom/vividsolutions/jts/geom/Coordinate;)Z

    move-result v6

    if-eqz v6, :cond_4

    if-ne v3, v4, :cond_2

    :cond_4
    move v6, v4

    :cond_5
    add-int/2addr v6, v1

    .line 202
    rem-int/2addr v6, v0

    .line 203
    aget-object v7, p0, v6

    invoke-virtual {v7, v5}, Lcom/vividsolutions/jts/geom/Coordinate;->equals2D(Lcom/vividsolutions/jts/geom/Coordinate;)Z

    move-result v7

    if-eqz v7, :cond_6

    if-ne v6, v4, :cond_5

    .line 205
    :cond_6
    aget-object v0, p0, v3

    .line 206
    aget-object p0, p0, v6

    .line 214
    invoke-virtual {v0, v5}, Lcom/vividsolutions/jts/geom/Coordinate;->equals2D(Lcom/vividsolutions/jts/geom/Coordinate;)Z

    move-result v3

    if-nez v3, :cond_a

    invoke-virtual {p0, v5}, Lcom/vividsolutions/jts/geom/Coordinate;->equals2D(Lcom/vividsolutions/jts/geom/Coordinate;)Z

    move-result v3

    if-nez v3, :cond_a

    invoke-virtual {v0, p0}, Lcom/vividsolutions/jts/geom/Coordinate;->equals2D(Lcom/vividsolutions/jts/geom/Coordinate;)Z

    move-result v3

    if-eqz v3, :cond_7

    goto :goto_2

    .line 217
    :cond_7
    invoke-static {v0, v5, p0}, Lcom/vividsolutions/jts/algorithm/CGAlgorithms;->computeOrientation(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)I

    move-result v3

    if-nez v3, :cond_9

    .line 231
    iget-wide v3, v0, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    iget-wide v5, p0, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    cmpl-double p0, v3, v5

    if-lez p0, :cond_8

    goto :goto_1

    :cond_8
    const/4 v1, 0x0

    goto :goto_1

    :cond_9
    if-lez v3, :cond_8

    :goto_1
    return v1

    :cond_a
    :goto_2
    return v2
.end method

.method public static isOnLine(Lcom/vividsolutions/jts/geom/Coordinate;[Lcom/vividsolutions/jts/geom/Coordinate;)Z
    .locals 5

    .line 151
    new-instance v0, Lcom/vividsolutions/jts/algorithm/RobustLineIntersector;

    invoke-direct {v0}, Lcom/vividsolutions/jts/algorithm/RobustLineIntersector;-><init>()V

    const/4 v1, 0x1

    const/4 v2, 0x1

    .line 152
    :goto_0
    array-length v3, p1

    if-ge v2, v3, :cond_1

    add-int/lit8 v3, v2, -0x1

    .line 153
    aget-object v3, p1, v3

    .line 154
    aget-object v4, p1, v2

    .line 155
    invoke-virtual {v0, p0, v3, v4}, Lcom/vividsolutions/jts/algorithm/RobustLineIntersector;->computeIntersection(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)V

    .line 156
    invoke-virtual {v0}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->hasIntersection()Z

    move-result v3

    if-eqz v3, :cond_0

    return v1

    :cond_0
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    :cond_1
    const/4 p0, 0x0

    return p0
.end method

.method public static isPointInRing(Lcom/vividsolutions/jts/geom/Coordinate;[Lcom/vividsolutions/jts/geom/Coordinate;)Z
    .locals 20

    move-object/from16 v0, p0

    move-object/from16 v1, p1

    const/4 v4, 0x1

    const/4 v5, 0x0

    .line 107
    :goto_0
    array-length v6, v1

    if-ge v4, v6, :cond_3

    add-int/lit8 v6, v4, -0x1

    .line 109
    aget-object v7, v1, v4

    .line 110
    aget-object v6, v1, v6

    .line 112
    iget-wide v8, v7, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    iget-wide v10, v0, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    cmpl-double v12, v8, v10

    if-lez v12, :cond_0

    iget-wide v8, v6, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    cmpg-double v12, v8, v10

    if-lez v12, :cond_1

    :cond_0
    iget-wide v8, v6, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    iget-wide v10, v0, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    cmpl-double v12, v8, v10

    if-lez v12, :cond_2

    iget-wide v8, v7, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    cmpg-double v12, v8, v10

    if-gtz v12, :cond_2

    .line 114
    :cond_1
    iget-wide v8, v7, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    iget-wide v10, v0, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    sub-double v12, v8, v10

    .line 115
    iget-wide v7, v7, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    iget-wide v14, v0, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    sub-double/2addr v7, v14

    .line 116
    iget-wide v2, v6, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    sub-double v16, v2, v10

    .line 117
    iget-wide v2, v6, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    sub-double/2addr v2, v14

    move-wide v14, v7

    move-wide/from16 v18, v2

    .line 121
    invoke-static/range {v12 .. v19}, Lcom/vividsolutions/jts/algorithm/RobustDeterminant;->signOfDet2x2(DDDD)I

    move-result v6

    int-to-double v10, v6

    sub-double/2addr v2, v7

    invoke-static {v10, v11}, Ljava/lang/Double;->isNaN(D)Z

    div-double/2addr v10, v2

    const-wide/16 v2, 0x0

    cmpl-double v6, v10, v2

    if-lez v6, :cond_2

    add-int/lit8 v5, v5, 0x1

    :cond_2
    add-int/lit8 v4, v4, 0x1

    goto :goto_0

    .line 134
    :cond_3
    rem-int/lit8 v5, v5, 0x2

    const/4 v0, 0x1

    if-ne v5, v0, :cond_4

    return v0

    :cond_4
    const/4 v0, 0x0

    return v0
.end method

.method public static orientationIndex(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)I
    .locals 12

    .line 80
    iget-wide v0, p1, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    iget-wide v2, p0, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    sub-double v4, v0, v2

    .line 81
    iget-wide v2, p1, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    iget-wide p0, p0, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    sub-double v6, v2, p0

    .line 82
    iget-wide p0, p2, Lcom/vividsolutions/jts/geom/Coordinate;->x:D

    sub-double v8, p0, v0

    .line 83
    iget-wide p0, p2, Lcom/vividsolutions/jts/geom/Coordinate;->y:D

    sub-double v10, p0, v2

    .line 84
    invoke-static/range {v4 .. v11}, Lcom/vividsolutions/jts/algorithm/RobustDeterminant;->signOfDet2x2(DDDD)I

    move-result p0

    return p0
.end method
